package com.ktjy.service;

import com.ktjy.dao.PetDao;
import com.ktjy.entity.Pet;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service("petService")
public class PetServiceImpl implements PetService {
//    @Resource(type = PetDaoOracleImpl.class)
    PetDao petDao;

    public void setPetDao(PetDao petDao) {
        this.petDao = petDao;
    }

    @Override
    public int addPet(Pet pet) {
        return petDao.addPet(pet);
    }

    @Override
    public boolean modify(Pet pet) {
        delay(2000);
        return false;
    }

    @Override
    public boolean del(Integer id) {
        delay(1000);
        return false;
    }

    private void delay(int time){
        try {
            Thread.sleep(time);
        }catch (InterruptedException e){
            e.printStackTrace();
        }
    }
}
